<?php
$subcatEditId=$_REQUEST['esubcat'];


if(isset($_REQUEST['CategoryKey']))
 {
	$catName=$_REQUEST['cat_name'];		
	$catDescription=$_REQUEST['cat_description'];
	$today=date("Y-m-d");		
	$sql_addcat="Update tbl_category set category_name='$catName',category_description='$catDescription' where category_id=$subcatEditId";
	$rst_addcat=mysql_query($sql_addcat) or die(mysql_error());	
	$msgEditScat="Subcategory Edited Successfully";
	
 }
 
 
$sqlSelEditSubcategory="select * from tbl_category where category_id=$subcatEditId";
$rstSelEditSubcategory=mysql_query($sqlSelEditSubcategory);
$rowSelEditSubcategory=mysql_fetch_array($rstSelEditSubcategory);
$subcategoryEditName=$rowSelEditSubcategory['category_name'];
$subcategoryEditDescription=$rowSelEditSubcategory['category_description'];
 
?>
<table width="100%"  border="1" cellspacing="0" class="container">
  <tr>
    <td width="469" height="25" class="tdHeader">Edit Subcategory</td>
  </tr>
  <tr>
    <td  height="577">
	<br><br>
          <form action="" method="post" name="formEditSubCat" id="formEditSubCat">
		  <input type="hidden" name="CategoryKey" id="CategoryKey">
           <table width="423" height="237" border="0" cellspacing="0" align="center">
          <tr>
            <td height="40" colspan="3"><div align="center"><?php echo "<b>".$msgEditScat."</b>"; ?></div></td>
            
          </tr>
		 
		  <tr>
		  	<td colspan="3">&nbsp;</td>
		  </tr>
          <tr>
            <td height="29">&nbsp;</td>
            <td><div align="left">Subcategory Name </div></td>
            <td>
              <div align="left">
                <input type="text" name="cat_name" id="cat_name" value="<?php echo $subcategoryEditName; ?>">
              </div></td>
          </tr>
		   <tr>
            <td height="31">&nbsp;</td>
            <td>Subcategory Description </td>
            <td><input type="text" name="cat_description" id="cat_description" value="<?php echo $subcategoryEditDescription; ?>"></td>
           </tr>		  
		  <tr>
            <td height="65" colspan="3"><div align="center">
                <input name="Submit" type="button" value="Edit Subcategory" class="button" onClick="editSubCatsubmit()">
              </div></td>
         </tr>
        </table>
       </form>
     </td>
  </tr>
</table>

